/*
 * FileName: ProjectServiceImpl.java
 *
 * Company: 
 * Copyright 2011-2012 (C) Ultrapower Software CO., LTD. All Rights Reserved.
 */
package com.jmeurope.service.impl;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import com.jmeurope.dao.ProjectDao;
import com.jmeurope.model.Project;
import com.jmeurope.service.ProjectService;

/**
 * <p>
 * Description: 
 * </p>
 *
 * @author wangwei  leo_java@163.com
 * @version 1.0

 * <p>
 * History: 
 *
 * Date                     Author         Version     Description
 * ---------------------------------------------------------------------------------
 * Jan 2, 2012 11:13:13 PM          wangwei        1.0         To create
 * </p>
 *
 * @since 
 * @see     
 */
@Service
@Transactional(propagation=Propagation.REQUIRED, rollbackFor=Exception.class)
@SuppressWarnings("unchecked")
public class ProjectServiceImpl implements ProjectService {
	
	@Autowired
	private ProjectDao projectDao;
	@Override
	public Integer addProject(Project project) throws Exception {
		// TODO Auto-generated method stub
		return projectDao.insert(project);
	}
	@Override
	public void deleteProject(Integer id) throws Exception {
		projectDao.delete(id);
	}
	@Override
	public List<Project> getAllProjects() throws Exception {
		return projectDao.findAll();
	}
	/**
	 * 通过模块id和项目信息状态查询新闻信息
	 * map ：
	 * 		 key：“status”  value： true or false
	 * 	  	 key：“bussinessId”  value：模块id
	 *    	 注意 map的key 必须按照上面定义写法
	 */

	@Override
	public List<Project> getProjecstByStatusAndBussinessId(Map map)
			throws Exception {
		return projectDao.getProjectsByStattusAndBussinessId(map);
	}

	@Override
	public Project getProjectById(Integer id) throws Exception {
		return projectDao.find(id);
	}
	/**
	map ：
	  		 key：“status”  value： true or false
	    	 注意 map的key 必须按照上面定义写法
    */
	@Override
	public List<Project> getProjectsByStatus(Map map) throws Exception {
		return projectDao.getProjectsByStatus(map);
	}

	/**
	 * map ：
	  		 key：“status”  value： true or false
	  		 key：“updateDate”  value： true or false
	    	 注意 map的key 必须按照上面定义写法
	 */
	@Override
	public List<Project> getProjectsByStatusAndupdateDate(Map map)
			throws Exception {
		return projectDao.getProjectsByStattusAndUpdateDate(map);
	}
	@Override
	public void updateProject(Project project) throws Exception {
		projectDao.update(project);
	}

}
